|
1
|
|
|
import React, { Component } from "react" |
|
2
|
|
|
import { Link } from "gatsby" |
|
3
|
|
|
import { PropTypes } from "prop-types" |
|
4
|
|
|
|
|
5
|
|
|
import { PlayerMinimal } from "./objects/player" |
|
6
|
|
|
|
|
7
|
|
|
import "./player--featured.scss" |
|
8
|
|
|
|
|
9
|
|
|
class PlayerFeatured extends Component { |
|
10
|
|
|
renderPlayerHeader = () => ( |
|
11
|
|
|
<header className={"player--featured__header"}> |
|
12
|
|
|
<div className={"bg-green-mask--horizontal"}> |
|
13
|
|
|
<div |
|
14
|
|
|
className={"player--featured__bg-avatar"} |
|
15
|
|
|
style={{ backgroundImage: `url(${this.props.player.imageSrc})` }} |
|
16
|
|
|
/> |
|
17
|
|
|
<div className={"bg-white-end"} /> |
|
18
|
|
|
</div> |
|
19
|
|
|
</header> |
|
20
|
|
|
) |
|
21
|
|
|
renderPlayerStats = () => ( |
|
22
|
|
|
<aside className={"player--featured__statistics"}> |
|
23
|
|
|
{this.renderGamesPlayed(this.props.player.gamesPlayed)} |
|
24
|
|
|
|
|
25
|
|
|
{this.props.player.position === "k" && |
|
26
|
|
|
this.renderCleansheets(this.props.player.cleanSheets)} |
|
27
|
|
|
|
|
28
|
|
|
{this.props.player.position !== "k" && |
|
29
|
|
|
this.renderGoals(this.props.player.goalsScored)} |
|
30
|
|
|
|
|
31
|
|
|
{this.renderCards(this.props.player.cardsYellow, "yellow")} |
|
32
|
|
|
{this.renderCards(this.props.player.cardsRed, "red")} |
|
33
|
|
|
</aside> |
|
34
|
|
|
) |
|
35
|
|
|
renderPlayerLink = () => ( |
|
36
|
|
|
<footer className={"player--featured__footer"}> |
|
37
|
|
|
<Link to={this.props.player.link} className="rich-link"> |
|
38
|
|
|
Meer over {this.props.player.nameFirst} » |
|
39
|
|
|
</Link> |
|
40
|
|
|
</footer> |
|
41
|
|
|
) |
|
42
|
|
|
renderPlayerName = () => ( |
|
43
|
|
|
<div className={"player--featured__name__wrapper"}> |
|
44
|
|
|
<h1 className={"player--featured__name"}> |
|
45
|
|
|
<span className={"player--featured__name-first"}> |
|
46
|
|
|
{this.props.player.nameFirst || "John"} |
|
47
|
|
|
</span> |
|
48
|
|
|
<span className={"player--featured__name-last"}> |
|
49
|
|
|
{this.props.player.nameLast || "Doe"} |
|
50
|
|
|
</span> |
|
51
|
|
|
</h1> |
|
52
|
|
|
<div className={"player--featured__bg-shirt-number"} aria-hidden="true"> |
|
53
|
|
|
{this.props.player.shirtNr || "0"} |
|
54
|
|
|
</div> |
|
55
|
|
|
</div> |
|
56
|
|
|
) |
|
57
|
|
|
renderGamesPlayed = (gamesPlayed) => ( |
|
58
|
|
|
<section className={"player--featured__statistics-item"}> |
|
59
|
|
|
<div className={"player--featured__statistics-item__number"}> |
|
60
|
|
|
{gamesPlayed || "0"} |
|
61
|
|
|
</div> |
|
62
|
|
|
<div className={"player--featured__statistics-item__label"}> |
|
63
|
|
|
Wedstrijden |
|
64
|
|
|
</div> |
|
65
|
|
|
</section> |
|
66
|
|
|
) |
|
67
|
|
|
renderCleansheets = (cleanSheets) => ( |
|
68
|
|
|
<section className={"player--featured__statistics-item"}> |
|
69
|
|
|
<div className={"player--featured__statistics-item__number"}> |
|
70
|
|
|
{cleanSheets || "0"} |
|
71
|
|
|
</div> |
|
72
|
|
|
<div className={"player--featured__statistics-item__label"}> |
|
73
|
|
|
Cleansheets |
|
74
|
|
|
</div> |
|
75
|
|
|
</section> |
|
76
|
|
|
) |
|
77
|
|
|
renderGoals = (goalsScored) => ( |
|
78
|
|
|
<section className={"player--featured__statistics-item"}> |
|
79
|
|
|
<div className={"player--featured__statistics-item__number"}> |
|
80
|
|
|
{goalsScored || "0"} |
|
81
|
|
|
</div> |
|
82
|
|
|
<div className={"player--featured__statistics-item__label"}> |
|
83
|
|
|
Doelpunten |
|
84
|
|
|
</div> |
|
85
|
|
|
</section> |
|
86
|
|
|
) |
|
87
|
|
|
|
|
88
|
|
|
renderCards = (cards, color) => ( |
|
89
|
|
|
<section |
|
90
|
|
|
className={ |
|
91
|
|
|
"player--featured__statistics-item player--featured__statistics-item--cards" |
|
92
|
|
|
} |
|
93
|
|
|
> |
|
94
|
|
|
<div className={"player--featured__statistics-item__number"}> |
|
95
|
|
|
{cards || "0"} |
|
96
|
|
|
</div> |
|
97
|
|
|
<div className={"player--featured__statistics-item__label"}> |
|
98
|
|
|
<span className={`stats__card stats__card--${color}`}></span> |
|
99
|
|
|
</div> |
|
100
|
|
|
</section> |
|
101
|
|
|
) |
|
102
|
|
|
|
|
103
|
|
|
render() { |
|
104
|
|
|
return ( |
|
105
|
|
|
<article className={"player--featured"}> |
|
106
|
|
|
{this.renderPlayerHeader()} |
|
107
|
|
|
<section className={"player--featured__content"}> |
|
108
|
|
|
{this.renderPlayerName()} |
|
109
|
|
|
{this.renderPlayerStats()} |
|
110
|
|
|
{this.props.player.link && this.renderPlayerLink()} |
|
111
|
|
|
</section> |
|
112
|
|
|
</article> |
|
113
|
|
|
) |
|
114
|
|
|
} |
|
115
|
|
|
} |
|
116
|
|
|
|
|
117
|
|
|
PlayerFeatured.propTypes = { |
|
118
|
|
|
player: PropTypes.instanceOf(PlayerMinimal).isRequired, |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
export default PlayerFeatured |
|
122
|
|
|
|